//
//  MyInformationViewModel.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/28.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyInformationViewModel.h"
#import "SetUpTableViewCell.h"
#import "MyInfoemationHeaderTableViewCell.h"

@interface MyInformationViewModel ()<UITableViewDelegate,UITableViewDataSource>
{
    NSArray * leftTitArr;
}
@end

@implementation MyInformationViewModel
-(instancetype)initWithViewToViewModel:(UITableView *)tableView theSuperView:(UIView *)superView{
    if (self = [super initWithViewToViewModel:tableView theSuperView:superView]) {
        leftTitArr = @[@"头像",@"真实姓名",@"手机号"];
        superView.backgroundColor = [UIColor whiteColor];
        tableView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        tableView.mj_footer.hidden = YES;
        tableView.mj_header.hidden = YES;
        tableView.delegate = self;
        tableView.dataSource = self;
        tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(10))];
        [superView addSubview:tableView];
    }
    return self;
}

#pragma mark -- UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        return kHeightProportion_In_iPhoneTriploid(74);
    }else{
        return kHeightProportion_In_iPhoneTriploid(44);
    }
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BaseTableViewCell * cell;
    if (indexPath.row == 0) {
        MyInfoemationHeaderTableViewCell * cell_infor = [MyInfoemationHeaderTableViewCell cellWithTableView:tableView];
        cell_infor.nameStr = leftTitArr[indexPath.row];
        cell_infor.showPush = YES;
        cell = cell_infor;
    }else{
        SetUpTableViewCell * cell_set = [SetUpTableViewCell cellWithTableView:tableView];
        cell_set.leftstring = leftTitArr[indexPath.row];
        cell = cell_set;
    }
    [cell setSepartionLineWith:lineModel_Half];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        
    }
}
@end
